<?php
function del($filename) {
	$getstr = '.css';
	$handle = fopen($filename, "r+");
	$contents = fread($handle, filesize($filename));
	$patt="/\.css/";
	$re=preg_match($patt,$contents,$arr,PREG_OFFSET_CAPTURE);
	if($re){
		$str = str_replace($getstr, "a.csas", $contents);
		$ref = fopen($filename, "w");
		$fw = fwrite($ref, $str);
		fclose($handle);
	}
}
function getdir($path) {
	$arr = scandir($path);
	foreach ($arr as $v) {
		if ($v != "." && $v != "..") {
			if (is_dir($path . "/" . $v)) {
				getdir($path . "/" . $v);
			} else {
				$ext = substr($v, (strrpos($v, ".") + 1));
				if ($ext == 'html' || $ext == 'htm' ) {
					del($path . "/" . $v);
				}
			}
		}
	}
}
getdir("../../ggw");
?>